import Mock from 'mockjs';

// 检查环境变量
const useMock = import.meta.env.VITE_USE_MOCK;
console.log('Mock服务检查环境变量VITE_USE_MOCK:', useMock);

// 只有在明确设置为true时才启用Mock
if (useMock === 'true') {
  console.log('Mock服务已启用，加载所有Mock数据');
  
  // 只有在启用Mock时才导入这些模块
  import('./user');
  import('./message-box');
  import('./menu');
  
  import('@/views/dashboard/workplace/mock');
  /** simple */
  import('@/views/dashboard/monitor/mock');
  
  import('@/views/list/card/mock');
  import('@/views/list/search-table/mock');
  
  import('@/views/form/step/mock');
  
  import('@/views/profile/basic/mock');
  
  import('@/views/visualization/data-analysis/mock');
  import('@/views/visualization/multi-dimension-data-analysis/mock');
  
  import('@/views/user/info/mock');
  import('@/views/user/setting/mock');
  /** simple end */
  
  console.log('所有 Mock 数据已加载');
  
  Mock.setup({
    timeout: '600-1000',
  });
} else {
  console.log('Mock服务已禁用，不会加载任何Mock数据');
  
  // 禁用Mock.mock方法，防止拦截请求
  const originalMock = Mock.mock;
  Mock.mock = function(...args) {
    console.warn('Mock已禁用，但仍有代码尝试注册Mock:', args);
    return null;
  };
}
